﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FrogEngine
{
	public interface ITree<N>
	{
		N Root { get; set; }
		
		int Size { get; }
		int Height();
		int Height(N start);
		int Depth(N node);

		void PreOrderTraversal<Y>(N start, Action<Y> visitAction);
		void PostOrderTraversal<Y>(N start, Action<Y> visitAction);
	}

	public interface ITreeNode<K, T>
	{
		K Key { get; set; }
		T Value { get; set; }
		bool IsExternal { get; }
		bool Visited { get; set; }
	}

	public interface IGeneralTreeNode<K, T> : ITreeNode<K, T>
	{
		IGeneralTreeNode<K, T> Parent { get; set; }
		IList<IGeneralTreeNode<K, T>> Children { get; }
	}

	public interface ISearchTree<K, T, N> : ITree<N>
	{
		N Find(N start, K key);
		void InsertItem(K key, T value);
		void RemoveItem(K key);
	}
}
